package com.Main.faislamovers;

import java.io.IOException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.MarshalBase64;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;

import com.Classes.Order;
import com.Classes.ViewReservation;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MyBooking extends Activity {

	// public static ArrayList<ViewReservation> myResLIst = new
	// ArrayList<ViewReservation>();

	String NAMESPACE = "http://tempuri.org/";
	String METHODNAME = "ViewReservation";
	String url = "http://10.0.2.2:53512/Service1.asmx";
	String SopaAction = "http://tempuri.org/ViewReservation";
	static String INFO_TAG = "[FM_INFO]";

	EditText txt_user_name, txt_phn_number;
	Button btn_get_ticket_details_xml;
	String str_txt_user_name, str_txt_phn_number;

	@Override
	protected void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		setContentView(R.layout.ticketdetails);

		txt_user_name = (EditText) findViewById(R.id.edt_txt_user_name);
		txt_phn_number = (EditText) findViewById(R.id.edt_txt_phon);

		btn_get_ticket_details_xml = (Button) findViewById(R.id.btn_get_ticket_details_xml);

		btn_get_ticket_details_xml.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				try {

					str_txt_user_name = txt_user_name.getText().toString();
					str_txt_phn_number = txt_phn_number.getText().toString();

					if (str_txt_phn_number.equals("")
							|| str_txt_phn_number.equals(null))

					{
						Log.i(INFO_TAG, "Phone Number is empty");
					} else if (str_txt_user_name.equals("")
							|| str_txt_user_name.equals(null)) {
						Log.i(INFO_TAG, "User Name is empty");
					} else {

						SharedPreferences pref = getSharedPreferences(
								AppConstants.PREFERENCES_NAME, 0);
						Editor editor = pref.edit();

						editor.putString(AppConstants.PHONE_NO,
								str_txt_phn_number);
						editor.putString(AppConstants.USER_NAME,
								str_txt_user_name);
						editor.commit();

						// boolean isSucess = setcustMsisdn();
						Intent bookingIntent = new Intent();

						bookingIntent.putExtra(AppConstants.PHONE_NO,
								str_txt_phn_number);
						bookingIntent.putExtra(AppConstants.USER_NAME,
								str_txt_user_name);
						bookingIntent.setClass(MyBooking.this,
								ViewReservationAdp.class);

						startActivity(bookingIntent);

					}

				}

				catch (Exception e) {
					e.printStackTrace();
				}

			}
		});

	}

}
